// src/router/menu.tsx
import { ReactNode } from "react";
// 这里是一个 TSX 的文件，因为使用到了 TSX 的语法表述 icon
import {
    UploadOutlined,
    AppstoreOutlined,
    ContainerOutlined,
    DesktopOutlined,
    MailOutlined,
    MenuFoldOutlined,
    MenuUnfoldOutlined,
    PieChartOutlined
} from '@ant-design/icons';

// 导入各级页面，在 React 中 就是 JSX 组件对象
import { Index as Home } from '../views/home/Index'
import { Index as Banner } from '../views/banner/Index'
import { List as BannerList } from '../views/banner/List'
import { Active as BannerActive } from '../views/banner/Active'
import { Add as BannerAdd } from '../views/banner/Add'
import { Index as Pro } from '../views/pro/Index'
import { Search as ProList } from '../views/pro/List'
import { Search as ProSerach } from '../views/pro/Search'
import { Index as Account } from '../views/user/Index'
import { UserList } from '../views/user/UserList'
import { AdminList } from '../views/user/AdminList'
import { Index as Setting } from '../views/set/Index'
// 添加 购物车列表管理
import { List as Cart } from '../views/cart/Index'

import DataIndex from '../views/data/Index'
import ECharts from '../views/data/Echarts'
import Highcharts from '../views/data/HighCharts'
import Antv from '../views/data/Antv'

import { Index as Editor } from '../views/editor/Index'
import { Braft } from '../views/editor/Braft'
import { MarkDown } from '../views/editor/MarkDown'

import { Index as Excel } from '../views/excel/Index'
import { Import } from '../views/excel/Import'
import { Export } from '../views/excel/Export'

import { Baidu } from '../views/map/Baidu'


export interface IMenuProps {
    // 当前路由设置一个标识，比对用户的权限，进而实现权限控制
    keyid: string,
    label: string
    icon?: any
    key: string
    children?: IMenuProps[],
    element: ReactNode,
    index?: number,
    // 标识当前路由是否隐藏
    hidden?: boolean
}


const menus: IMenuProps[] = [
    {
        keyid: '0-0',
        label: '系统首页',
        icon: <AppstoreOutlined />,
        key: '/',
        element: <Home />
    },
    {
        keyid: '0-1',
        label: '轮播图管理',
        icon: <ContainerOutlined />,
        key: '/banner',
        element: <Banner />,
        children: [
            {
                keyid: '0-1-0',
                label: '添加轮播图',
                icon: <DesktopOutlined />,
                key: '/banner/add',
                element: <BannerAdd />
            },
            {
                keyid: '0-1-1',
                label: '首页轮播图',
                index: 1,
                icon: <DesktopOutlined />,
                key: '/banner/home',
                element: <BannerList />
            },
            // {
            //     keyid: '0-1-2',
            //     label: '活动页轮播图',
            //     icon: <MailOutlined />,
            //     key: '/banner/active',
            //     element: <BannerActive />
            // }
        ]
    },
    {
        keyid: '0-2',
        label: '产品管理',
        icon: <MenuFoldOutlined />,
        key: '/pro',
        element: <Pro />,
        children: [
            {
                keyid: '0-2-0',
                label: '产品列表',
                icon: <UploadOutlined />,
                key: '/pro/list',
                element: <ProList />
            },
            {
                keyid: '0-2-1',
                label: '筛选列表',
                index: 1,
                icon: <UploadOutlined />,
                key: '/pro/search',
                element: <ProSerach />
            }
        ]
    },
    {
        keyid: '0-3',
        label: '账户管理',
        icon: <MenuUnfoldOutlined />,
        key: '/account',
        element: <Account />,
        children: [
            {
                keyid: '0-3-0',
                label: '用户列表',
                icon: <UploadOutlined />,
                key: '/account/userlist',
                element: <UserList />
            },
            {
                keyid: '0-3-1',
                label: '管理员列表',
                index: 1,
                icon: <UploadOutlined />,
                key: '/account/adminlist',
                element: <AdminList />
            }
        ]
    },
    {
        keyid: '0-4',
        label: '数据可视化',
        icon: <UploadOutlined />,
        key: '/data',
        element: <DataIndex />,
        children: [
            {
                keyid: '0-4-0',
                label: 'ECharts',
                index: 1,
                icon: <UploadOutlined />,
                key: '/data/echarts',
                element: <ECharts />,
            },
            {
                keyid: '0-4-1',
                label: 'Highcharts',
                icon: <UploadOutlined />,
                key: '/data/highcharts',
                element: <Highcharts />,
            },
            {
                keyid: '0-4-2',
                label: 'Antv',
                icon: <UploadOutlined />,
                key: '/data/antv',
                element: <Antv />,
            }
        ]
    },
    {
        keyid: '0-5',
        label: '编辑器',
        icon: <UploadOutlined />,
        key: '/editor',
        element: <Editor />,
        children: [
            {
                keyid: '0-5-0',
                label: '富文本编辑器',
                index: 1,
                icon: <UploadOutlined />,
                key: '/editor/braft',
                element: <Braft />,
            },
            {
                keyid: '0-5-1',
                label: 'markdown编辑器',
                icon: <UploadOutlined />,
                key: '/editor/md',
                element: <MarkDown />,
            }
        ]
    },
    {
        keyid: '0-6',
        label: '购物车管理',
        icon: <PieChartOutlined />,
        key: '/cart',
        element: <Cart />
    },
    {
        keyid: '0-7',
        label: '设置',
        icon: <PieChartOutlined />,
        key: '/setting',
        element: <Setting />,
        hidden: true
    },
    {
        keyid: '0-8',
        label: '导入以及导出',
        icon: <UploadOutlined />,
        key: '/excel',
        element: <Excel />,
        children: [
            {
                keyid: '0-8-0',
                label: '导入',
                index: 1,
                icon: <UploadOutlined />,
                key: '/excel/import',
                element: <Import />,
            },
            {
                keyid: '0-8-1',
                label: '导出',
                icon: <UploadOutlined />,
                key: '/excel/export',
                element: <Export />,
            }
        ]
    },
    {
        keyid: '0-9',
        label: '百度地图',
        icon: <UploadOutlined />,
        key: '/baidumap',
        element: <Baidu />,
    }
]
export default menus